﻿using System;

namespace YArchitech.Plumbing
{
	public class CirclePipe
	{
		public CirclePipe()
		{
		}

		public CirclePipe(CirclePipe circlePipe)
		{
			this.preSerialNum = circlePipe.preSerialNum;
			this.serialNum = circlePipe.serialNum;
			this.resistTCValve = circlePipe.resistTCValve;
			this.opening = circlePipe.opening;
			this.pressCapital = circlePipe.pressCapital;
			this.pressActual = circlePipe.pressActual;
			this.rateUnbalance = circlePipe.rateUnbalance;
			this.pipeData = new HYPipeData(circlePipe.pipeData);
			this.pipeData.Diameter = 20;
			this.load = circlePipe.load;
			this.flow = circlePipe.flow;
			this.TemperSupply = circlePipe.TemperSupply;
			this.TemperReturn = circlePipe.TemperReturn;
			this.resCoefLocal = circlePipe.resCoefLocal;
		}

		private double GetFlow()
		{
			return GHCalcMethods.GetFlowByLoad(this.Load, this.TemperSupply, this.TemperReturn);
		}

		public string PreSerialNum
		{
			get
			{
				return this.preSerialNum;
			}
			set
			{
				this.preSerialNum = value;
			}
		}

		public string SerialNum
		{
			get
			{
				return this.serialNum;
			}
			set
			{
				this.serialNum = value;
			}
		}

		public double Load
		{
			get
			{
				return this.load;
			}
			set
			{
				this.load = value;
			}
		}

		public double Flow
		{
			get
			{
				return this.GetFlow();
			}
			set
			{
				this.flow = value;
			}
		}

		public double ResistTcValve
		{
			get
			{
				return this.resistTCValve;
			}
			set
			{
				this.resistTCValve = value;
			}
		}

		public double Opening
		{
			get
			{
				return this.opening;
			}
			set
			{
				this.opening = value;
			}
		}

		public double PressCapital
		{
			get
			{
				return this.pressCapital;
			}
			set
			{
				this.pressCapital = value;
			}
		}

		public double PressActual
		{
			get
			{
				return this.pressActual;
			}
			set
			{
				this.pressActual = value;
			}
		}

		public double RateUnbalance
		{
			get
			{
				return this.rateUnbalance;
			}
			set
			{
				this.rateUnbalance = value;
			}
		}

		public double ResCoefLocal
		{
			get
			{
				return this.PipeData.ResCoefLocal;
			}
			set
			{
				this.resCoefLocal = value;
			}
		}

		public HYPipeData PipeData
		{
			get
			{
				if (this.pipeData.Load == 0.0)
				{
					this.pipeData.Load = this.Load;
				}
				if (this.pipeData.Flow == 0.0)
				{
					this.pipeData.Flow = this.Flow;
				}
				return this.pipeData;
			}
			set
			{
				this.pipeData = value;
			}
		}

		public double TemperSupply
		{
			get
			{
				return this.temperSupply;
			}
			set
			{
				this.temperSupply = value;
			}
		}

		public double TemperReturn
		{
			get
			{
				return this.temperReturn;
			}
			set
			{
				this.temperReturn = value;
			}
		}

		private string preSerialNum;

		private string serialNum;

		private double load;

		private double flow;

		private double resistTCValve;

		private double opening;

		private double pressCapital;

		private double pressActual;

		private double rateUnbalance;

		private double resCoefLocal;

		private HYPipeData pipeData;

		private double temperSupply;

		private double temperReturn;
	}
}
